package com.bjpowernode.service.impl;

import com.bjpowernode.dao.ThumbsDao;
import com.bjpowernode.service.ThumbsService;
import com.bjpowernode.user.Dynamic;
import com.bjpowernode.user.Thumbs;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ThumbsServiceImpl implements ThumbsService {

    @Resource
    private ThumbsDao thumbsDao;

    @Override
    public int addThumbs(Thumbs thumbs) {
        Thumbs resThumbs = thumbsDao.selectThumbs(thumbs);
        if (resThumbs != null){
            return 0;
        }
        return thumbsDao.insertThumbs(thumbs);
    }

    @Override
    public int removeThumbs(Thumbs thumbs) {
        return thumbsDao.deleteThumbs(thumbs);
    }

    @Override
    public List<Dynamic> findSelfThumbs(String name) {
        return thumbsDao.selectSelfThumbs(name);
    }
}
